﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Isc.Core
{
    /// <summary>
    /// 可持久化到数据库的基类
    /// </summary>
    /// <typeparam name="TKey"></typeparam>
    public abstract class EntityBase<TKey>
    {

        protected EntityBase()
        {
            IsDeleted = false;
            CreatedTime = DateTime.Now;
            CreatedBy = "System";
        }

        #region 属性

        /// <summary>
        /// 获取或设置 实体唯一标识，主键
        /// </summary> 
        public TKey Id { get; set; }

        /// <summary>
        /// 获取或设置 是否删除，逻辑上的删除，非物品删除
        /// </summary>
        public bool IsDeleted { get; set; }

        /// <summary>
        /// 获取或设置 创建时间
        /// </summary>
        public DateTime CreatedTime { get; set; }

        /// <summary>
        /// 获取或设置 创建者
        /// </summary>
        public string CreatedBy { get; set; }

        /// <summary>
        /// 获取或设置 更新时间
        /// </summary>
        public Nullable<DateTime> UpdatedTime { get; set; }

        /// <summary>
        /// 获取或设置 更新者
        /// </summary>
        public string UpdatedBy { get; set; }


        /// <summary>
        /// 获取或设置 排序id
        /// </summary>
        public int SortId { get; set; }


        /// <summary>
        /// 获取或设置 备注
        /// </summary>
        public string Remark { get; set; }

        /// <summary>
        /// 获取或设置 版本控制标识，用于处理并发
        /// </summary> 
        public byte[] Timestamp { get; set; }

        #endregion

       
    }
}
